//
//  ListRequest.m
//  Dvjf_ios
//
//  Created by Ji on 2018/9/6.
//  Copyright © 2018年 ski. All rights reserved.
//

#import "XvmSEfJLCFListRequestdkZIyb.h"
#import "IIteyOJLCFListMainModelOxfUlK.h"
#import "qdDrwAJLCFListWelfareResultModelwSyhjE.h"
#import "ALQDleJLCFListOrderResultModelGICuga.h"
#import "BURunJJLCFListPayCompleteResultModelyMhLTy.h"
#import "JLCFBaseDicModel.h"
#import "MdckAUJLCFListRecodModelSbWSuQ.h"


#define LIST_URL                                                       QTZ_REQUEST_URL(@"borrow/borrows")
#define lIST_DETAIL_URL                                                QTZ_REQUEST_URL(@"borrow/getBorrow/auth")
#define MONEYLOG_URL                                                   QTZ_REQUEST_URL(@"borrow/getBorrowInvestmentRecords")
#define WELFARE_URL                                                    QTZ_REQUEST_URL(@"activity/availableHb/auth")
#define LIST_TO_ORDER_URL                                              QTZ_REQUEST_URL(@"borrow/agree/toBorrowOrder/auth")
#define PAYCOMPLETE_URL                                                QTZ_REQUEST_URL(@"borrow/postFuiouPay/auth")
#define SENDCODE_URL                                                   QTZ_REQUEST_URL(@"user/sendFuiouCode/auth")

#define PAYFOR_RESTMONEY_URL                                           QTZ_REQUEST_URL(@"borrow/account/buyBorrow/auth")


@implementation XvmSEfJLCFListRequestdkZIyb

+ (void)postListDataWithParams:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(oOowQqJLCFListDataModeluDifDm *))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:LIST_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        IIteyOJLCFListMainModelOxfUlK *data = [[IIteyOJLCFListMainModelOxfUlK alloc] initWithDictionary:result error:nil];
        if ([data.code isEqualToString:@"200"]) {
            if (success) {
                success(data.data);
            }
        } else {
            if (failure) {
                failure(data.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
}

+ (void)postListDetailDataWithParams:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(QddEjIJLCFListDetailResultModelNVtUPx *))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:lIST_DETAIL_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        QddEjIJLCFListDetailResultModelNVtUPx *TgzwxAresultModelZWmmrE = [[QddEjIJLCFListDetailResultModelNVtUPx alloc] initWithDictionary:result error:nil];
        if ([TgzwxAresultModelZWmmrE.code isEqualToString:@"200"]) {
            if (success) {
                success(TgzwxAresultModelZWmmrE);
            }
        } else {
            if (failure) {
                failure(TgzwxAresultModelZWmmrE.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
}

+ (void)listRecordWithParams:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(hphaptJLCFMineMoneyLogResultModeldhpqVh *))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:MONEYLOG_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        hphaptJLCFMineMoneyLogResultModeldhpqVh *money = [[hphaptJLCFMineMoneyLogResultModeldhpqVh alloc] initWithDictionary:result error:nil];
        
        if ([money.code isEqualToString:@"200"]) {
            if (success) {
                success(money);
            }
        } else {
            if (failure) {
                failure(money.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
}

+ (void)welfareWithParams:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(qBSjUSJLCFListWelfareDataModelmtizAG *))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:WELFARE_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        qdDrwAJLCFListWelfareResultModelwSyhjE *TgzwxAresultModelZWmmrE = [[qdDrwAJLCFListWelfareResultModelwSyhjE alloc] initWithDictionary:result error:nil];
        if ([TgzwxAresultModelZWmmrE.code isEqualToString:@"200"]) {
            if (success) {
                success(TgzwxAresultModelZWmmrE.data);
            }
        } else {
            if (failure) {
                failure(TgzwxAresultModelZWmmrE.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
}

+ (void)toBorrowOrderWithParams:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(RpJUgMJLCFListOrderDataModelYevCTI *))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:LIST_TO_ORDER_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        ALQDleJLCFListOrderResultModelGICuga *TgzwxAresultModelZWmmrE = [[ALQDleJLCFListOrderResultModelGICuga alloc] initWithDictionary:result error:nil];
        if ([TgzwxAresultModelZWmmrE.code isEqualToString:@"200"]) {
            if (success) {
                success(TgzwxAresultModelZWmmrE.data);
            }
        } else {
            if (failure) {
                failure(TgzwxAresultModelZWmmrE.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
}

+ (void)payCompleteWithParams:(NSDictionary *)params loadingInView:(UIView *)view paySuccess:(void (^)(YgMWMCJLCFFuyouInfoModelNQcnsr *))paySuccess payFailure:(void (^)(NSString *))payFailure failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:PAYCOMPLETE_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        JLCFBaseDicModel *pay = [[JLCFBaseDicModel alloc] initWithDictionary:result error:nil];
        
        if ([pay.code isEqualToString:@"200"]) {
            if (paySuccess) {
                paySuccess([[YgMWMCJLCFFuyouInfoModelNQcnsr alloc] initWithDictionary:pay.data error:nil]);
            }
        } else if ([pay.code isEqualToString:@"405"]) {
            if (payFailure) {
                payFailure(pay.msg);
            }
        } else {
            if (failure) {
                failure(pay.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
    
    
}

+ (void)sendCodeWithParams:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(void))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:SENDCODE_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        JLCFBaseDicModel *dic = [[JLCFBaseDicModel alloc] initWithDictionary:result error:nil];
        
        if ([dic.code isEqualToString:@"200"]) {
            if (success) {
                success();
            }
        } else {
            if (failure) {
                failure(dic.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
}
+ (void)getBorrowRecord:(NSDictionary *)params loadingInView:(UIView *)view success:(void(^)(MdckAUJLCFListRecodModelSbWSuQ *))success failure:(void(^)(NSString *error))failure
{
    [[JLCFHttpManager sharedManager] postDataWithUrl:MONEYLOG_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        MdckAUJLCFListRecodModelSbWSuQ *model = [[MdckAUJLCFListRecodModelSbWSuQ alloc] initWithDictionary:result error:nil];
        if ([model.code isEqualToString:@"200"]) {
            if (success) {
                success(model);
            }
        } else {
            if (failure) {
                failure(model.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
}

+ (void)welfareWith:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(qBSjUSJLCFListWelfareDataModelmtizAG *))success failure:(void (^)(NSString *))failure
{
    
    [[JLCFHttpManager sharedManager] postDataWithUrl:WELFARE_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        qdDrwAJLCFListWelfareResultModelwSyhjE *dic = [[qdDrwAJLCFListWelfareResultModelwSyhjE alloc] initWithDictionary:result error:nil];
        
        if ([dic.code isEqualToString:@"200"]) {
            if (success) {
                success(dic.data);
            }
        } else {
            if (failure) {
                failure(dic.msg);
            }
        }
        
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
    
}


//余额支付
+ (void)payRestMoneyWith:(NSDictionary *)params loadingInView:(UIView *)view success:(void (^)(snBMFMJLCFListPayCompleteDataModelykwCAI *))success failure:(void (^)(NSString *))failure{
    [[JLCFHttpManager sharedManager] postDataWithUrl:PAYFOR_RESTMONEY_URL params:params loadingInView:view success:^(NSDictionary *result) {
        
        BURunJJLCFListPayCompleteResultModelyMhLTy *dic = [[BURunJJLCFListPayCompleteResultModelyMhLTy alloc] initWithDictionary:result error:nil];
        
        if ([dic.code isEqualToString:@"200"]) {
            if (success) {
                success(dic.data);
            }
        } else {
            if (failure) {
                failure(dic.msg);
            }
        }
    } failure:^(NSString *status) {
        if (failure) {
            failure(status);
        }
    }];
}

@end
